package com.tao.controller;

import com.alibaba.fastjson.JSONObject;
import com.tao.pojo.Color;
import com.tao.pojo.ColorExample;
import com.tao.service.color.IcolorService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
@RequestMapping("/color")
public class ColorController {

    @Autowired
    IcolorService colorService;

    @RequestMapping(value = "/show.do",produces="application/json;charset=utf-8")
    @ResponseBody
    public String show(){
        ColorExample colorExample = new ColorExample();
        colorExample.createCriteria().andIsDelEqualTo(0);
        List<Color> colors = colorService.getColors(colorExample);
        return JSONObject.toJSONString(colors);
    }
}
